﻿using UnityEngine;

namespace Framework
{
    /// <summary>
    /// 生命周期事件组件
    /// 使用独立的组件是为了避免OnDestroy等事件重写容易产生混淆
    /// </summary>
    public class LifecycleBehaviour : MonoBehaviour
    {
        public delegate void OnDestroyDelegate();

        public event OnDestroyDelegate OnDestroyEvent;

        private void OnDestroy()
        {
            OnDestroyEvent?.Invoke();
        }
    }
}